// import com.alibaba.druid.sql.ast.SQLExpr;
// import com.alibaba.druid.sql.ast.SQLObject;
// import com.alibaba.druid.sql.dialect.oracle.ast.OracleSQLObjectImpl;
// import com.alibaba.druid.sql.dialect.oracle.visitor.OracleASTVisitor;

// import java.util.Arrays;
// import java.util.List;

#include "OracleDatetimeExpr.h"
#include "../../../../ast/SQLObject.h"
#include "../../visitor/OracleASTVisitor.h"

OracleDatetimeExpr::OracleDatetimeExpr()
{
}

OracleDatetimeExpr::OracleDatetimeExpr(SQLExpr_ptr expr, SQLExpr_ptr timeZone)
{
  this->expr = expr;
  this->timeZone = timeZone;
}

// @Override
void OracleDatetimeExpr::accept0(OracleASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(OracleDatetimeExpr)))
  {
    acceptChild(visitor, expr);
    acceptChild(visitor, timeZone);
  }
  visitor->endVisit(SharedObject(OracleDatetimeExpr));
}

SQLExpr_ptr OracleDatetimeExpr::getExpr()
{
  return expr;
}

void OracleDatetimeExpr::setExpr(SQLExpr_ptr expr)
{
  this->expr = expr;
}

SQLExpr_ptr OracleDatetimeExpr::getTimeZone()
{
  return timeZone;
}

void OracleDatetimeExpr::setTimeZone(SQLExpr_ptr timeZone)
{
  this->timeZone = timeZone;
}

SQLObject_ptr OracleDatetimeExpr::clone()
{
  SQLObject_ptr clone_tmp = std::shared_ptr<OracleDatetimeExpr>(new OracleDatetimeExpr());
  std::shared_ptr<OracleDatetimeExpr> x = std::dynamic_pointer_cast<OracleDatetimeExpr>(clone_tmp);
  // OracleDatetimeExpr x = new OracleDatetimeExpr();

  if (expr != nullptr)
  {
    x->setExpr(std::dynamic_pointer_cast<SQLExpr>(expr->clone()));
  }

  if (timeZone != nullptr)
  {
    x->setTimeZone(std::dynamic_pointer_cast<SQLExpr>(timeZone->clone()));
  }

  return x;
}

// @Override
SQLObject_list_ptr OracleDatetimeExpr::getChildren()
{
  SQLObject_list_ptr tmp = std::make_shared<std::list<SQLObject_ptr>>();
  tmp->push_back(this->expr);
  tmp->push_back(this->timeZone);
  return tmp;
}
